<include file="Public:header" />
<include file="Public:leftside" />

<style type="text/css">
	.modal {
		height: 600px;
	}
	
	.modal-infp-style {
		width: 90%;
		margin: 10px auto;
	}
	
	.modal-infp-style table {
		width: 100%;
	}
	
	.modal-infp-style table tr td {
		border: 1px solid #e6e6e6;
		padding: 8px;
	}
	
	a:hover {
		cursor: pointer;
	}
</style>
<div class="main-content">
	<div class="breadcrumbs breadcrumbs-fixed" id="breadcrumbs">
		<ul class="breadcrumb">
			<li> <i class="icon-home home-icon"></i>
				<a href="/">首页</a>
			</li>
			<li><a href="{:U('Users/area_angel')}">区域代言人管理</a></li>

		</ul>
	</div>
	<section class="scrollable wrapper">

		
		<section class="panel panel-default">
			<div class="table-responsive">
				<table class="table table-striped b-t b-light text-sm">
					<thead>
						<tr>

							<th>id</th>
							<th class="center">用户</th>
							<th class="center">推荐人</th>
							<th class="center">代言区域</th>
							<th class="center" width="150">状态</th>
							<th class="center" width="550">原因</th>
							<th class="center">操作</th>
						</tr>
					</thead>
					<tbody id="list">
						<foreach name="list" item="v">
							<tr>
								<th >
									{$v['id']}
								</th>
								<th  class="center">
									{$v['phone']}
								</th>
								<th  class="center">
									<php>
										$partent=M('partner')
												->field('yt_users.*')
												->join('yt_users on yt_users.id=yt_partner.u_id')
												->where('yt_partner.id='.$v['panter_id'])
												->find();
									</php>
									{$partent.phone}
								</th>
								<th  class="center">
									<php>
										if($v['province_id']){
										$province=getProvinceInfo($v['province_id']);
										}else{
										$province='';
										}
										if($v['city_id']){
										$city=getCityInfo($v['city_id']);
										}else{
										$city='';
										}
										if($v['district_id']){
										$district=getDistrictInfo($v['district_id']);
										}else{
										$district='';
										}

									</php>
									{$province.province_name} {$city.city_name} {$district.district_name}
								</th>
							<th class="center">
								<php>
									if($v['status']==-1){echo "拒绝";}
									if($v['status']==4){echo "总后台通过";}
									if($v['status']==1){echo "省申请通过";}
									if($v['status']==2){echo "市申请通过";}
									if($v['status']==3){echo "区申请通过";}


								</php>
							</th>
								<th class="center" style="line-height: 39px;height: 39px;display: block;overflow: hidden;margin: 0;padding: 0;">
									{$v.reason}
								</th>


							<th class="center">
								<php>
									$id=session('id');
									if($id==$v['panter_id']&&$user_info['level']<=$v['status']){
								</php>
								<a href="{:U('users/edit_angel',array('id'=>$v['id']))}"> 编辑</a>
								<php>}</php>
								<php>if($v['status']!=4&&$v['status']!=-1){</php>
									<a href="javascript:;" class="edit_status" style="color: green" data="4" uid="{$v['id']}">通过</a> <a href="javascript:;" data="-1" style="color: red;" uid="{$v['id']}" class="edit_status" >拒绝</a>
								<php>}else{</php>
								无
								<php>}</php>
							</th>
							</tr>
						</foreach>
					</tbody>
				</table>
			</div>



		</section>

	</section>
</div>
<script src="/Partner/static/js/jquery.min.js?v=2.1.4"></script>
<script src="/static/js/layer2.1/layer.js"></script>
<link href="/static/css/jquery.mCustomScrollbar.min.css" rel="stylesheet">
<script type="text/javascript" src="/static/js/jquery.mCustomScrollbar.concat.min.js"></script>
<script>
	$(function () {
		$('.edit_status').click(function () {
			var id=$(this).attr('uid');
			var data=$(this).attr('data');
			if(data==-1){
                var msg='您是否确认拒绝？'
			}else{
                var msg='您是否确认通过？'
			}
            layer.confirm(msg, {
                btn: ['确认','再想想'] //按钮
            }, function(){
                $.ajax({
                    type: "post",
                    url: "{:U('users/edit_angel_status')}",
                    data: {
                        'id': id,
                        'data': data
                    },
                    success: function(data) {
                        if(data==1){
                            layer.msg('提交成功');
                            setTimeout("location.reload()",1000);
                        }
                        if(data==0){
                            layer.msg('提交失败');
                        }

                    }
                });
            }, function(){

            });
        })
    })
</script>
<include file="Public:footer" />

